import request from '../interceptor'

/**
 * @description 添加appid用户和appkey
 */
export const addAppidUser = (data: {
  name: string
  appid?: string
  appkey?: string
  desc?: string
  expiresTime: string
  apis?: any[]
}) =>
  request({
    url: '/appidUser',
    method: 'post',
    data,
  })

/**
 * @description appid用户列表
 */
export const getAppidUserList = (params: { page?: number; pageSize?: number; name?: string }) =>
  request({
    url: '/appidUser/list',
    params,
  })

/**
 * @description 删除appid用户
 */
export const delAppidUser = (id: string) =>
  request({
    url: `/appidUser/${id}`,
    method: 'delete',
  })

/**
 * @description 修改appid用户信息
 */
export const updateAppidUser = (
  id: string,
  data: {
    name: string
    appid?: string
    appkey?: string
    desc?: string
    expiresTime: string
    apis?: any[]
  },
) =>
  request({
    url: `/appidUser/${id}`,
    method: 'put',
    data,
  })
